export default {
    FilterType(state) {
        return (onlyShowText) => {
            if (onlyShowText) {
                return state.merchant.filter((v) => v.text.length != 0)

            } else {
                return state.merchant
            }


        }

    },
    FilterType0(state) {
        return (onlyShowText) => {
            if (onlyShowText) {
                return state.merchant.filter((v) => v.text.length != 0&&v.rateType==0)

            } else {
                return state.merchant.filter((v) => v.rateType==0)
            }


        }
    },
    FilterType1(state) {
        return (onlyShowText) => {
            if (onlyShowText) {
                return state.merchant.filter((v) => {
                    if(v.text.length!=0&&v.rateType==1){
                        return v    
                    }
                })
            } else {
                // return state.merchant
                return state.merchant.filter((v) => v.rateType==1)
            }


        }
    },
    FilterText(state,getters) {
        return (onlyShowText, selectType) => {
           if(selectType==0){
            return getters.FilterType0(onlyShowText)
           }else if(selectType==1){
            return getters.FilterType1(onlyShowText)
           }else{
            return getters.FilterType(onlyShowText)
           }
        }
    },
    shopcart(state){
        let arr=[];
        state.goods&&state.goods.forEach((element) => {
            element.foods.forEach((v)=>{
                if(v.count>0){
                 arr.push(v)   
                }
            })
        });
        return arr
    }
}